package com.ghxxzx.dagl.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.ghxxzx.dagl.entity.Daxx;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;

import java.util.ArrayList;
import java.util.List;
@Repository
public interface DaxxMapper extends BaseMapper<Daxx> {
    @Select("SELECT * FROM `daxx` where dabh=#{dabh} LIMIT 1")
    Daxx findByDabh(String dabh);

    @Select("SELECT MAX(year) FROM daxx")
    String findByMaxYear();

    @Select("SELECT `year` FROM daxx WHERE type_id=${typeId} GROUP BY `year`")
    ArrayList<String> findGroupByYear(@Param("typeId") Integer typeId);

    @Select("SELECT type_id FROM daxx WHERE dabh=#{dabh}")
    Integer findByDanbh(@Param("dabh")String dabh);
}
